<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center purchasedCourse_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub purchasedCourse_fd0_0'>
					<view class='flex flex-wrap align-center purchasedCourse_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  purchasedCourse_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
					</view>
					<view class='flex flex-wrap align-center justify-end purchasedCourse_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			
			<view class="loading_css" v-if="isShow">
				<u-loading size="36" color="#AD3823"></u-loading>
				<view>加载中</view>
			</view>
			
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout purchasedCourse_flex_1" v-else>
				<view class='flex flex-wrap align-center purchasedCourse_fd1_0'>
					<text class='purchasedCourse_fd1_0_c0'>已购课程</text>
				</view>
				<view class='flex flex-direction flex-wrap align-stretch purchasedCourse_fd1_1' v-if="list.length > 0">
					<view class='flex flex-direction flex-wrap align-stretch purchasedCourse_fd1_1_c0' :style="{backgroundImage: 'url(' + item.image + ')'}" v-for="(item, index) in list" :key="k" @tap.stop="handleJumpDiy" data-type="navigateTo" :data-url="`/pages/shouye/detailsPage/detailsPage?order_sn=${item.order_sn}`">
						<image class='purchasedCourse_fd1_1_c0_c0' mode="aspectFit" :src='STATIC_URL+"515.png"'></image>
						<view class='flex flex-direction flex-wrap align-center purchasedCourse_fd1_1_c0_c1'>
							<text class='purchasedCourse_fd1_1_c0_c1_c0'>{{item.package_name}}{{item.course_num}}个</text>
							<text class='purchasedCourse_fd1_1_c0_c1_c1'>（{{item.category_name}}）</text>
						</view>
					</view>
					<view class="loadmore" v-if="last_page > 1">
						<u-loadmore font-size="24" :status="status" :icon-type="iconType" :load-text="loadText" />
					</view>
				</view>
				<!-- <view class="noData" v-if="list.length == 0 && !isShow">
					<image :src='STATIC_URL+"no.png"'></image>
				</view> -->
			</view>

			<!---flex布局flex布局结束-->


		</view>
	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"list": [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getList();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getList();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {
		
				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getList();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			getList() {
				this.$api.post(global.API_VERSION + '65587ed9b7559', {
					page: this.page
				}).then(res => {
					// console.log(res);
					uni.stopPullDownRefresh();
					this.isShow = false;
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: url(https://www.guochaoxiaoju.com/uploads/mini/633.png) no-repeat;
		background-size: 100% 100%;
	}

	.purchasedCourse_flex_0 {
		// background: url(https://www.guochaoxiaoju.com/uploads/mini/633.png) no-repeat;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.purchasedCourse_fd0_0_c0_c0 {
		font-size: 38rpx;
		color: var(--benbenFontColor3);
	}

	.purchasedCourse_fd0_0_c0 {
		width: 120rpx;
	}

	.purchasedCourse_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.purchasedCourse_flex_1 {
		padding: 0rpx 30rpx 0rpx 30rpx;
	}

	.purchasedCourse_fd1_1_c2 {
		background: url(https://www.guochaoxiaoju.com/uploads/mini/635.png) no-repeat;
		background-size: 100% auto;
		position: relative;
	}

	.purchasedCourse_fd1_1_c1 {
		background: url(https://www.guochaoxiaoju.com/uploads/mini/634.png) no-repeat;
		background-size: 100% auto;
		position: relative;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.purchasedCourse_fd1_1_c0_c1_c1 {
		color: #333333;
		font-size: 34rpx;
		font-weight: 400;
		margin: 15rpx 0rpx 4rpx 0rpx;
		font-family: Alimama DongFangDaKai, Alimama DongFangDaKai;
	}

	.purchasedCourse_fd1_1_c0_c1_c0 {
		color: #333333;
		font-size: 48rpx;
		font-weight: 400;
		font-family: Alimama DongFangDaKai, Alimama DongFangDaKai;
	}

	.purchasedCourse_fd1_1_c0_c1 {
		margin: 48rpx 0rpx 48rpx 0rpx;
	}

	.purchasedCourse_fd1_1_c0_c0 {
		width: 56rpx;
		height: 56rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		position: absolute;
		left: 24rpx;
		top: 24rpx;
	}

	.purchasedCourse_fd1_1_c0 {
		// background: url(https://www.guochaoxiaoju.com/uploads/mini/514.png) no-repeat;
		background-repeat: no-repeat;
		background-size: 100% 100%;
		position: relative;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.purchasedCourse_fd1_1 {
		border: 2px solid #AD3823;
		background: #FFFFFF;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		width: 690rpx;
		box-shadow: 0rpx 0rpx 20rpx 1rpx rgba(0, 0, 0, 0.16), inset 0rpx 0rpx 16rpx 1rpx #AD3823;
		padding: 32rpx 24rpx 32rpx 24rpx;
	}

	.purchasedCourse_fd1_0_c0 {
		color: #FFFFFF;
		font-size: 64rpx;
		font-weight: 400;
		font-family: Alimama DongFangDaKai, Alimama DongFangDaKai;
	}

	.purchasedCourse_fd1_0 {
		padding: 0rpx 0rpx 0rpx 12rpx;
		margin: 48rpx 0rpx 59rpx 0rpx;
	}
</style>